const SERVICE = require("../../lib/js/service.js");

Page({
  data:{
    showNoData: false
  },
  
  onLoad(){
    this.getCashCoupon();
  },

  /*分享*/
  onShareAppMessage(){

  },

  /**
   * @explain cashCoupon 现金券
   * @param   thirdCookie 用户标识
   * 
   * */ 
  getCashCoupon(){
    wx.showNavigationBarLoading();
    let _this = this;
    SERVICE.POST(SERVICE.URL.cashCoupon,{
      thirdCookie: wx.getStorageSync("thirdCookie")
    },(status,res)=>{
      wx.hideNavigationBarLoading();
      if(res.data.status === "success"){
        _this.setData({
          info: res.data
        });
        if (res.data.records_list.length === 0){
          _this.setData({
            showNoData: true
          });
        }
      }else{
        wx.showToast({
          title: "获取信息失败",
          icon: "none",
          mask: true
        });
      }
    });
  }
});